[IMP] color picker: add eye dropper support#8737
Conversation
1c768c4 to
046a04f
Compare
7488c1c to
ebf0f6f
Compare
046a04f to
b9ac93f
Compare
|
this will need to be documented as Chrome only as it's not even in the path of becoming a standard https://wicg.github.io/eyedropper-api/ |
| } | ||
| } catch (error) { | ||
| if (error.name !== "AbortError") { | ||
| console.error("Error using the eye dropper:", error); |
There was a problem hiding this comment.
a silent fail will not be that helpful. what can go wrong ?
There was a problem hiding this comment.
AbortError is not really an error, it's when you press escape to abort the color picking. Skipping those make sense.
I guess I could throw the other errors instead of logging then in the console tho
b9ac93f to
fc05188
Compare
|
robodoo r+ |
|
@hokolomopo @rrahir because this PR has multiple commits, I need to know how to merge it:
|
|
robodoo r- |
fc05188 to
b3ce441
Compare
| } | ||
|
|
||
| get canUseEyeDropper(): boolean { | ||
| return !!globalThis.EyeDropper && !this.env.model.getters.isDarkMode(); |
There was a problem hiding this comment.
dark mode 😢
Worth a comment saying why it cannot work in in dark mode
| // In dark mode we'd have to do the opposite color inversion than then dark mode color inversion to get the correct color. | ||
| // But this mathematically cannot always be done, because our color inversion lose information with clipping and rounding. |
There was a problem hiding this comment.
👍
move or copy/paste this comment in the business code
- `globalThis.Chart` was defined twice - `ChartGeo` was defined in `window` instead of `globalThis` Task: 6226285
b3ce441 to
eab48da
Compare
|
rebased + comment added |
|
@hokolomopo @LucasLefevre 'ci/runbot' failed on this reviewed PR. |
This commit adds a button to pick a color from anywhere on your screen using the EyeDropper API. The EyeDropper API is still experimental and not widely supported (only on desktop chromium browser at the time of writing this), so we make sure the button is only there when the API is avilable. Task: 6226285
eab48da to
91479ce
Compare
|
robodoo r+ |
|
robodoo rebase-ff |
|
Merge method set to rebase and fast-forward. |
- `globalThis.Chart` was defined twice - `ChartGeo` was defined in `window` instead of `globalThis` Task: 6226285 Part-of: #8737 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>
This commit adds a button to pick a color from anywhere on your screen using the EyeDropper API. The EyeDropper API is still experimental and not widely supported (only on desktop chromium browser at the time of writing this), so we make sure the button is only there when the API is avilable. closes #8737 Task: 6226285 Signed-off-by: Lucas Lefèvre (lul) <lul@odoo.com>

Description:
[IMP] color picker: add eye dropper support
This commit adds a button to pick a color from anywhere on your
screen using the EyeDropper API.
The EyeDropper API is still experimental and not widely supported
(only on desktop chromium browser at the time of writing this),
so we make sure the button is only there when the API is avilable.
[IMP] typing: improve
globalThistypingglobalThis.Chartwas defined twiceChartGeowas defined inwindowinstead ofglobalThisTask: 6226285
review checklist